﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IceDog.Lib.People
{
    public class Person : IComparable<Person>,IComparable
    {
        public Person(string name,int age)
        {
            this.Name = name;
            this.Age = age;
        }

        public string Name { get; set; }
        public int Age { get; set; }
        /// <summary>
        /// 比较两个人的年龄
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public int CompareTo(Person other)
        {
            return this.Age - other.Age;
        }

        public int CompareTo(object obj)
        {
            return this.CompareTo((Person)obj);
        }
    }
}
